import React, { memo } from 'react';
import ReactECharts from 'echarts-for-react';
//下面是按需加载
// import echarts from 'echarts/lib/echarts'
import 'echarts/lib/component/tooltip';
import 'echarts/lib/component/title';
import 'echarts/lib/component/legend';
import 'echarts/lib/component/markPoint';
//导入折线图
import 'echarts/lib/chart/bar';  //折线图是line,饼图改为pie,柱形图改为bar


const getOption = ()=>{
  let  option = {
        title: {
          text: '柱形图',
          left:'5%'
        },
        tooltip: {
          trigger:'axis',
        },
        legend: {
          data: ['销量','库存'],
          right:'5%'
        },
        xAxis: {
          data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
        },
        yAxis: {},
        series: [
          {
            name: '销量',
            type: 'bar',
            data: [5, 20, 36, 10, 10, 20]
          },{
            name: '库存',
            type: 'bar',
            data: [15, 30, 46, 20, 20, 40]
          }
        ]
      };
   return option
}
export default memo(function HjBar() {
  return (
    <ReactECharts option={getOption()} />
  )
})
